//
//  StatusesModel.swift
//  Weibo
//
//  Created by mac on 16/1/16.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

class StatusesModel: NSObject {

    /// 微博ID
     var id: Int64 = 0
    /// 微博信息内容
     var text: String?
    /// 微博来源
    var source: String?
    /// 用户信息
    var user: UserInfo?
    ///构造函数
    init(dict: [String : AnyObject]) {
        super.init()
        self.setValuesForKeysWithDictionary(dict)
        
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user" {
            
            if let dic: [String : AnyObject] = value as? [String : AnyObject] {
                user = UserInfo(dic: dic)
                return
            }
            
        }
        super.setValue(value, forKey: key)
        
    }
    
    
    
    override var description:String {
        
        let keys: [String] = ["id","text"]
        
        let des = dictionaryWithValuesForKeys(keys)
        return des.description
    }
    
    
    
    
}
